package com.example.demo.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.example.demo.custom.BaseRepository;
import com.example.demo.entity.SysUser;
import com.example.demo.entity.ThreadInput;
import com.example.demo.entity.ThreadInput2;

@Repository
public interface ThreadInput2Repository extends BaseRepository<ThreadInput2,Integer> {



	public List<ThreadInput2> findByThread(ThreadInput sale1);

	public List<ThreadInput2> findByPhone(String phone);

	public List<ThreadInput2> findByPhoneAndThreadUserId(String phone, SysUser user);

	/**
	 * @param car
	 * @return 通过时间排序得到最新一条
	 */
	@Query(value = "SELECT  *  FROM thread_input2 t WHERE t.thread_id=? ORDER BY t.begin_date DESC LIMIT 1 ",nativeQuery=true)
	public ThreadInput2 findByThread2(Integer id);
}
